package com.shunli.cterminal.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.examples.core.mybatis.mapper.KyLambdaQueryWrapper;
import com.shunli.cterminal.entity.LayerDO;
import com.shunli.cterminal.model.req.LayerPageReq;

import java.util.List;

/**
 * ab实验-流量层 Mapper
 *
 * @author 后台管理员
 */
@DS("adEngine")
public interface LayerMapper extends BaseMapper<LayerDO> {

    default List<LayerDO> queryLayerList(LayerPageReq reqVO) {
        return selectList(new KyLambdaQueryWrapper<LayerDO>()
                .eqIfPresent(LayerDO::getAppId, reqVO.getAppId())
                .eqIfPresent(LayerDO::getIdType, reqVO.getIdType())
                .inIfPresent(LayerDO::getLayerCode,reqVO.getLayerCodeList())
                .likeIfPresent(LayerDO::getLayerName, reqVO.getLayerName())
                .eqIfPresent(LayerDO::getLayerCode, reqVO.getLayerCode())
                .eqIfPresent(LayerDO::getExtraParams, reqVO.getExtraParams())
                .betweenIfPresent(LayerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LayerDO::getId));
    }

}